pp108 : Download (Object)

Download (Object)


The Download control is used to download files from any server or a service group running in Cordys. This control is derived from the Download library. For details about the control's behavior and functionality, see Download.

You can use the Message Map to create associations between this control and any required model. The mapping that you define between the control and the model is stored in a mapping object.

Properties, Events, and Methods of the Control


The properties, events, and methods associated with the Download control define its behavior. You can set them either through the control's property sheet or programmatically using the APIs. For details, see Download.

The following XForms-related property is available for the control:

Table 1. List of Properties

Property

Description

ID

Sets the string that identifies the control on an XForm. If not specified, a unique ID is automatically generated.

Model

Sets the ID of the data model from which data (specified using the Reference property) is downloaded.

searchPath

String that denotes a tag in the SOAP response, the content of which needs to be downloaded.

Content Type

String that denotes the HTTP content type of the file to be downloaded. By default, this is application/octet-stream.

File Name

String that denotes the file name to be displayed while opening or saving the file. This property is optional. This property accepts only ASCII characters.

Frame ID

String that denotes the ID of the frame element in which the file can be downloaded. If this is not mentioned, the component downloads the content into the page that sent the request.

Note:
The Mozilla Firefox and Google Chrome browsers do not support the functionality provided by the Frame ID property.

Request

Sets the request for the control. For this, you can use a method available in the Workspace or provide a SOAP request. If a SOAP request is provided, it must not include the SOAP:Envelope or SOAP:Body tag.

When a model is selected, the Get method of the model is automatically associated with the control and is displayed in the Request field of the control's property sheet. Additionally, default mapping assignments are created between the model's business object and the control's request.In case, the nodes in a business object and the parameters of a request do not match, an alert displays stating that the mapping is not successful and prompting you to verify the mapping. In this case, you must manually define the mapping assignments using the message map.The mapping assignments are updated whenever you update the model or the request for the control.

Timeout

Integer that denotes the time (in milliseconds) that can be taken for the download method.

Open in New Window

Opens a new window to download files.



The following XForms-related methods are available for the control:

Table 2. List of Events

Event

Description

On Before Download

Fires before the download process starts.

On Download Error

Fires when an error or SOAP fault occurs when downloading.



The following XForms-related methods are available for the control:

Table 3. List of Methods

Method

Description

addListener(sEventName, fpFunction)

This method registers a function to an event, such that the function gets called when the event is fired on the control.

getBusinessObject()

This method retrieves data or business object.

removeListener(sEventName, fpFunction)

This method unregisters a function from an event, such that the function stops getting called when the event is fired on the control.


Remarks


If a business object is selected for a control to which the model is attached, the download request that is fired contains parameter values based on the message map assignments.